{extend name="base" /}
{block name="body"}
<style type="text/css">
    .mleft {
        margin-right: 10px;
    }
</style>
<div class="layui-body">
    <!--tab标签-->
    <div class="layui-tab layui-tab-brief">
        <ul class="layui-tab-title">
            <li class="layui-this">游戏结算详情</li>
        </ul>
        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <div class="layui-form-item">

                    <div class="layui-inline">
                        <a href="javascript:;" onclick="history.go(-1)" class="layui-btn">返回</a>
                    </div>
                </div>
                <hr>
                <table class="layui-table">
                    <thead>
                    <tr>
                        <th>日期</th>
                        {if condition="input('type') eq 2"}
                            <th>渠道名称</th>
                        {else /}
                            <th>游戏供应商</th>
                        {/if}
                        <th>游戏名称</th>
                        <th>总充值</th>
                        {if condition="input('type') eq 2"}
                            <th>渠道分成</th>
                        {else /}
                            <th>游戏分成</th>
                            <th>通道费</th>
                        {/if}
                        <th>艾七分成</th>
                        <th>结算状态</th>
                    </tr>
                    </thead>
                    <tbody>
                    {if condition="$counts > 0"}
                        {foreach name="list" item="vo"}
                        <tr>
                            <td>{$vo['date_month']}</td>
                            {if condition="input('type') eq 2"}
                                <td>{:get_channel_name($vo['cid'])}</td>
                            {else /}
                                <td>{:get_cp_name($vo['cp_id'])}</td>
                            {/if}
                                <td>{:get_game_filed($vo['gid'],'name')}</td>
                                <td>{$vo['amount']}</td>
                            {if condition="input('type') eq 2"}
                                <td>{:round($vo['c_fencheng'],2)}</td>
                            {else /}
                                <td>{:round($vo['g_fencheng'],2)}</td>
                                <td>{:round($vo['g_fee'],2)}</td>
                            {/if}
                            <td>{:round($vo['amount'] - $vo['g_fencheng'] - $vo['c_fencheng'],2)}</td>
                        {if condition="input('type') eq 2"}
                            <th>{if condition="$vo['c_status'] eq 0"}未结算{else、}已结算{/if}</th>
                        {else /}
                            <th>{if condition="$vo['status'] eq 0"}未结算{else、}已结算{/if}</th>
                        {/if}

                        </tr>
                        {/foreach}
                    {else /}
                        <tr>
                            <td style="text-align: center" colspan="11">暂无数据</td>
                        </tr>
                    {/if}
                </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="script"}
<script>
layui.use(['jquery','laydate'],function () {
    var laydate = layui.laydate;
    var $ = layui.$;

    var startDate = layui.laydate.render({
        elem: '#starttime',
        min: '2017-12-28',
        type: 'month',  // 设置为month类型，只选择年月
        format: 'yyyy-MM',  // 设置显示格式为年月
        done: function(value, date) {
            if (value !== '') {
                endDate.config.min.year = date.year;
                endDate.config.min.month = date.month - 1;
                // 对于month类型，date对象可能没有hours/minutes/seconds属性
                endDate.config.btns = ['clear', 'confirm'];
            } else {
                endDate.config.min.year = '';
                endDate.config.min.month = '';
                endDate.config.btns = ['clear', 'now', 'confirm'];
            }
        }
    });

var endDate = layui.laydate.render({
      elem: '#endtime',
      min: '2017-12-28',
    type: 'month',  // 设置为month类型，只选择年月
    format: 'yyyy-MM',  // 设置显示格式为年月
    done: function(value, date) {
        if (value !== '') {
            endDate.config.min.year = date.year;
            endDate.config.min.month = date.month - 1;
            // 对于month类型，date对象可能没有hours/minutes/seconds属性
            endDate.config.btns = ['clear', 'confirm'];
        } else {
            endDate.config.min.year = '';
            endDate.config.min.month = '';
            endDate.config.btns = ['clear', 'now', 'confirm'];
        }
    }
    });
});

// 导出
$('#exportBtn').on('click', function() {
    // var formDataArray = $('form').serializeArray();
    $('form').attr('action', '{:url("/admin/export")}').submit();
    $('form').attr('action', '{:url("/admin/recharge/months")}');
});
</script>
{/block}